<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>CryptoAuthLib: swi_bitbang_samd21.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">CryptoAuthLib
   </div>
   <div id="projectbrief">Microchip CryptoAuthentication Library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('a00554.html','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a>  </div>
  <div class="headertitle">
<div class="title">swi_bitbang_samd21.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Hardware Interface Functions - SWI bit-banged.  
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &quot;<a class="el" href="a00173_source.html">atca_status.h</a>&quot;</code><br />
<code>#include &lt;delay.h&gt;</code><br />
</div>
<p><a href="a00554_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a01145.html">SWIBuses</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:af9d9d027ce20f528edea144203141714"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00554.html#af9d9d027ce20f528edea144203141714">MAX_SWI_BUSES</a>&#160;&#160;&#160;36</td></tr>
<tr class="memdesc:af9d9d027ce20f528edea144203141714"><td class="mdescLeft">&#160;</td><td class="mdescRight">SAMD21 xplainned pro has 36 free GPIO pins available.  <a href="#af9d9d027ce20f528edea144203141714">More...</a><br /></td></tr>
<tr class="separator:af9d9d027ce20f528edea144203141714"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr><td colspan="2"><div class="groupHeader">Macros for Bit-Banged SWI Timing</div></td></tr>
<tr><td colspan="2"><div class="groupText"><p>Times to drive bits at 230.4 kbps. </p>
</div></td></tr>
<tr class="memitem:ad884cf7d66d88b38180369a791a9824b"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00554.html#ad884cf7d66d88b38180369a791a9824b">BIT_DELAY_1L</a>&#160;&#160;&#160;<a class="el" href="a00993.html#gafd0e52ccc611a61fcd1b0b6cd1a19efd">delay_us</a>(3)</td></tr>
<tr class="separator:ad884cf7d66d88b38180369a791a9824b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1ce4882b7d053eafcec22cd84fb5727d"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00554.html#a1ce4882b7d053eafcec22cd84fb5727d">BIT_DELAY_1H</a>&#160;&#160;&#160;<a class="el" href="a00993.html#gafd0e52ccc611a61fcd1b0b6cd1a19efd">delay_us</a>(3)</td></tr>
<tr class="memdesc:a1ce4882b7d053eafcec22cd84fb5727d"><td class="mdescLeft">&#160;</td><td class="mdescRight">should be 4.34 us, is 4.05us  <a href="#a1ce4882b7d053eafcec22cd84fb5727d">More...</a><br /></td></tr>
<tr class="separator:a1ce4882b7d053eafcec22cd84fb5727d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2ced4699fc4ab5162dbb9453edecb32e"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00554.html#a2ced4699fc4ab5162dbb9453edecb32e">BIT_DELAY_5</a>&#160;&#160;&#160;<a class="el" href="a00993.html#gafd0e52ccc611a61fcd1b0b6cd1a19efd">delay_us</a>(26)</td></tr>
<tr class="separator:a2ced4699fc4ab5162dbb9453edecb32e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abd0d20a34060650b8a2895c17f842f44"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00554.html#abd0d20a34060650b8a2895c17f842f44">BIT_DELAY_7</a>&#160;&#160;&#160;<a class="el" href="a00993.html#gafd0e52ccc611a61fcd1b0b6cd1a19efd">delay_us</a>(34)</td></tr>
<tr class="separator:abd0d20a34060650b8a2895c17f842f44"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a60ba93807a2c0ea2ce1432245f3f7da0"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00554.html#a60ba93807a2c0ea2ce1432245f3f7da0">RX_TX_DELAY</a>&#160;&#160;&#160;<a class="el" href="a00993.html#gafd0e52ccc611a61fcd1b0b6cd1a19efd">delay_us</a>(65)</td></tr>
<tr class="separator:a60ba93807a2c0ea2ce1432245f3f7da0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab10604796b42fb6b8eed23fc88ebd47f"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00554.html#ab10604796b42fb6b8eed23fc88ebd47f">START_PULSE_TIME_OUT</a>&#160;&#160;&#160;(600)</td></tr>
<tr class="separator:ab10604796b42fb6b8eed23fc88ebd47f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad935b86cd295ba61924231e29033c55b"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00554.html#ad935b86cd295ba61924231e29033c55b">ZERO_PULSE_TIME_OUT</a>&#160;&#160;&#160;(40)</td></tr>
<tr class="separator:ad935b86cd295ba61924231e29033c55b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a076fc28889d32327dd3372538106da92"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00554.html#a076fc28889d32327dd3372538106da92">swi_set_pin</a> (uint8_t id)</td></tr>
<tr class="memdesc:a076fc28889d32327dd3372538106da92"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set SWI signal pin. Other functions will use this pin.  <a href="#a076fc28889d32327dd3372538106da92">More...</a><br /></td></tr>
<tr class="separator:a076fc28889d32327dd3372538106da92"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad78929b51b34df503a37b4961577d5ce"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00554.html#ad78929b51b34df503a37b4961577d5ce">swi_enable</a> (void)</td></tr>
<tr class="memdesc:ad78929b51b34df503a37b4961577d5ce"><td class="mdescLeft">&#160;</td><td class="mdescRight">Configure GPIO pin for SWI signal as output.  <a href="#ad78929b51b34df503a37b4961577d5ce">More...</a><br /></td></tr>
<tr class="separator:ad78929b51b34df503a37b4961577d5ce"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af016fffdce9f520096de8631e6692707"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00554.html#af016fffdce9f520096de8631e6692707">swi_disable</a> (void)</td></tr>
<tr class="memdesc:af016fffdce9f520096de8631e6692707"><td class="mdescLeft">&#160;</td><td class="mdescRight">Configure GPIO pin for SWI signal as input.  <a href="#af016fffdce9f520096de8631e6692707">More...</a><br /></td></tr>
<tr class="separator:af016fffdce9f520096de8631e6692707"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a79bc8f2b72647fce853274cf8474b41e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00554.html#a79bc8f2b72647fce853274cf8474b41e">swi_set_signal_pin</a> (uint8_t is_high)</td></tr>
<tr class="memdesc:a79bc8f2b72647fce853274cf8474b41e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set signal pin Low or High.  <a href="#a79bc8f2b72647fce853274cf8474b41e">More...</a><br /></td></tr>
<tr class="separator:a79bc8f2b72647fce853274cf8474b41e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ada6b4629603758b67820568677ab2a19"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00554.html#ada6b4629603758b67820568677ab2a19">swi_send_wake_token</a> (void)</td></tr>
<tr class="memdesc:ada6b4629603758b67820568677ab2a19"><td class="mdescLeft">&#160;</td><td class="mdescRight">Send a Wake Token.  <a href="#ada6b4629603758b67820568677ab2a19">More...</a><br /></td></tr>
<tr class="separator:ada6b4629603758b67820568677ab2a19"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af0382e26c4d83b0762b39d12c772dd2e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00554.html#af0382e26c4d83b0762b39d12c772dd2e">swi_send_bytes</a> (uint8_t count, uint8_t *buffer)</td></tr>
<tr class="memdesc:af0382e26c4d83b0762b39d12c772dd2e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Send a number of bytes.This function should not be called directly ,instead should use <a class="el" href="a00993.html#gaeb8b8857192a7710785acce0110e8016" title="Send byte(s) via SWI.">hal_swi_send()</a> which call this function.  <a href="#af0382e26c4d83b0762b39d12c772dd2e">More...</a><br /></td></tr>
<tr class="separator:af0382e26c4d83b0762b39d12c772dd2e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1c5ab22e67923ee54eef0e33b227be0b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00554.html#a1c5ab22e67923ee54eef0e33b227be0b">swi_send_byte</a> (uint8_t byte)</td></tr>
<tr class="memdesc:a1c5ab22e67923ee54eef0e33b227be0b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Send one byte.  <a href="#a1c5ab22e67923ee54eef0e33b227be0b">More...</a><br /></td></tr>
<tr class="separator:a1c5ab22e67923ee54eef0e33b227be0b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afa009f7d683cb82293570a27d1f8ee10"><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00173.html#a22bd6643f31f1d75dc3e7ea939f468cd">ATCA_STATUS</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00554.html#afa009f7d683cb82293570a27d1f8ee10">swi_receive_bytes</a> (uint8_t count, uint8_t *buffer)</td></tr>
<tr class="memdesc:afa009f7d683cb82293570a27d1f8ee10"><td class="mdescLeft">&#160;</td><td class="mdescRight">Receive a number of bytes.This function should not be called directly ,instead should use <a class="el" href="a00993.html#ga02e9f36723f0feb21d373898728de04b" title="Receive byte(s) via SWI.">hal_swi_receive()</a> which call this function.  <a href="#afa009f7d683cb82293570a27d1f8ee10">More...</a><br /></td></tr>
<tr class="separator:afa009f7d683cb82293570a27d1f8ee10"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:a8ba5507b651724b4cdc74106a16b025c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="a01145.html">SWIBuses</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00554.html#a8ba5507b651724b4cdc74106a16b025c">swi_buses_default</a></td></tr>
<tr class="separator:a8ba5507b651724b4cdc74106a16b025c"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Hardware Interface Functions - SWI bit-banged. </p>
<dl class="section copyright"><dt>Copyright</dt><dd>(c) 2015-2018 Microchip Technology Inc. and its subsidiaries. </dd></dl>
</div><h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a1ce4882b7d053eafcec22cd84fb5727d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1ce4882b7d053eafcec22cd84fb5727d">&#9670;&nbsp;</a></span>BIT_DELAY_1H</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define BIT_DELAY_1H&#160;&#160;&#160;<a class="el" href="a00993.html#gafd0e52ccc611a61fcd1b0b6cd1a19efd">delay_us</a>(3)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>should be 4.34 us, is 4.05us </p>

</div>
</div>
<a id="ad884cf7d66d88b38180369a791a9824b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad884cf7d66d88b38180369a791a9824b">&#9670;&nbsp;</a></span>BIT_DELAY_1L</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define BIT_DELAY_1L&#160;&#160;&#160;<a class="el" href="a00993.html#gafd0e52ccc611a61fcd1b0b6cd1a19efd">delay_us</a>(3)</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>delay macro for width of one pulse (start pulse or zero pulse) should be 4.34 us, is 4.05 us </p>

</div>
</div>
<a id="a2ced4699fc4ab5162dbb9453edecb32e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2ced4699fc4ab5162dbb9453edecb32e">&#9670;&nbsp;</a></span>BIT_DELAY_5</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define BIT_DELAY_5&#160;&#160;&#160;<a class="el" href="a00993.html#gafd0e52ccc611a61fcd1b0b6cd1a19efd">delay_us</a>(26)</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>time to keep pin high for five pulses plus stop bit (used to bit-bang CryptoAuth 'zero' bit) should be 26.04 us, is 26.92 us </p>

</div>
</div>
<a id="abd0d20a34060650b8a2895c17f842f44"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abd0d20a34060650b8a2895c17f842f44">&#9670;&nbsp;</a></span>BIT_DELAY_7</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define BIT_DELAY_7&#160;&#160;&#160;<a class="el" href="a00993.html#gafd0e52ccc611a61fcd1b0b6cd1a19efd">delay_us</a>(34)</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>time to keep pin high for seven bits plus stop bit (used to bit-bang CryptoAuth 'one' bit) should be 34.72 us, is 35.13 us </p>

</div>
</div>
<a id="af9d9d027ce20f528edea144203141714"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af9d9d027ce20f528edea144203141714">&#9670;&nbsp;</a></span>MAX_SWI_BUSES</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define MAX_SWI_BUSES&#160;&#160;&#160;36</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>SAMD21 xplainned pro has 36 free GPIO pins available. </p>

</div>
</div>
<a id="a60ba93807a2c0ea2ce1432245f3f7da0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a60ba93807a2c0ea2ce1432245f3f7da0">&#9670;&nbsp;</a></span>RX_TX_DELAY</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define RX_TX_DELAY&#160;&#160;&#160;<a class="el" href="a00993.html#gafd0e52ccc611a61fcd1b0b6cd1a19efd">delay_us</a>(65)</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>turn around time when switching from receive to transmit should be 93 us (Setting little less value as there would be other process before these steps) </p>

</div>
</div>
<a id="ab10604796b42fb6b8eed23fc88ebd47f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab10604796b42fb6b8eed23fc88ebd47f">&#9670;&nbsp;</a></span>START_PULSE_TIME_OUT</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define START_PULSE_TIME_OUT&#160;&#160;&#160;(600)</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Lets set the timeout value for start pulse detection to the uint8_t maximum. This value is decremented while waiting for the falling edge of a start pulse. </p>

</div>
</div>
<a id="ad935b86cd295ba61924231e29033c55b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad935b86cd295ba61924231e29033c55b">&#9670;&nbsp;</a></span>ZERO_PULSE_TIME_OUT</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define ZERO_PULSE_TIME_OUT&#160;&#160;&#160;(40)</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Maximum time between rising edge of start pulse and falling edge of zero pulse is 8.6 us. Therefore, a value of 40 (around 15 us) gives ample time to detect a zero pulse and also leaves enough time to detect the following start pulse. This value is decremented while waiting for the falling edge of a zero pulse. </p>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="af016fffdce9f520096de8631e6692707"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af016fffdce9f520096de8631e6692707">&#9670;&nbsp;</a></span>swi_disable()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void swi_disable </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Configure GPIO pin for SWI signal as input. </p>

</div>
</div>
<a id="ad78929b51b34df503a37b4961577d5ce"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad78929b51b34df503a37b4961577d5ce">&#9670;&nbsp;</a></span>swi_enable()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void swi_enable </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Configure GPIO pin for SWI signal as output. </p>

</div>
</div>
<a id="afa009f7d683cb82293570a27d1f8ee10"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afa009f7d683cb82293570a27d1f8ee10">&#9670;&nbsp;</a></span>swi_receive_bytes()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="a00173.html#a22bd6643f31f1d75dc3e7ea939f468cd">ATCA_STATUS</a> swi_receive_bytes </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>count</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>buffer</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Receive a number of bytes.This function should not be called directly ,instead should use <a class="el" href="a00993.html#ga02e9f36723f0feb21d373898728de04b" title="Receive byte(s) via SWI.">hal_swi_receive()</a> which call this function. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">count</td><td>number of bytes to receive </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">buffer</td><td>pointer to receive buffer</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>ATCA_SUCCESS on success, otherwise an error code. </dd></dl>
<p>Receive bits and store in buffer.</p>
<p>Detect start bit.</p>
<p>Wait for falling edge.</p>
<p>Wait for rising edge.</p>
<p>let's just wait the maximum time for the falling edge of a zero bit to arrive after we have detected the rising edge of the start bit.</p>
<p>Detect possible edge indicating zero bit.</p>
<p>Wait for rising edge of zero pulse before returning. Otherwise we might interpret its rising edge as the next start pulse.</p>
<p>Update byte at current buffer index.</p>
<p>received "one" bit</p>
<p>Indicate that we timed out after having received at least one byte. </p>

</div>
</div>
<a id="a1c5ab22e67923ee54eef0e33b227be0b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1c5ab22e67923ee54eef0e33b227be0b">&#9670;&nbsp;</a></span>swi_send_byte()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void swi_send_byte </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>byte</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Send one byte. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">byte</td><td>byte to send </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="af0382e26c4d83b0762b39d12c772dd2e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af0382e26c4d83b0762b39d12c772dd2e">&#9670;&nbsp;</a></span>swi_send_bytes()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void swi_send_bytes </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>count</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>buffer</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Send a number of bytes.This function should not be called directly ,instead should use <a class="el" href="a00993.html#gaeb8b8857192a7710785acce0110e8016" title="Send byte(s) via SWI.">hal_swi_send()</a> which call this function. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">count</td><td>number of bytes to send. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">buffer</td><td>pointer to buffer containing bytes to send </td></tr>
  </table>
  </dd>
</dl>
<p>&lt; Send Logic 1 (7F)</p>
<p>&lt; Send Logic 0 (7D) </p>

</div>
</div>
<a id="ada6b4629603758b67820568677ab2a19"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ada6b4629603758b67820568677ab2a19">&#9670;&nbsp;</a></span>swi_send_wake_token()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void swi_send_wake_token </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Send a Wake Token. </p>

</div>
</div>
<a id="a076fc28889d32327dd3372538106da92"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a076fc28889d32327dd3372538106da92">&#9670;&nbsp;</a></span>swi_set_pin()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void swi_set_pin </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>id</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set SWI signal pin. Other functions will use this pin. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">id</td><td>definition of GPIO pin to be used </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a79bc8f2b72647fce853274cf8474b41e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a79bc8f2b72647fce853274cf8474b41e">&#9670;&nbsp;</a></span>swi_set_signal_pin()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void swi_set_signal_pin </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>is_high</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set signal pin Low or High. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">is_high</td><td>0: Low, else: High. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a id="a8ba5507b651724b4cdc74106a16b025c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8ba5507b651724b4cdc74106a16b025c">&#9670;&nbsp;</a></span>swi_buses_default</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="a01145.html">SWIBuses</a> swi_buses_default</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_97aefd0d527b934f1d99a682da8fe6a9.html">lib</a></li><li class="navelem"><a class="el" href="dir_e870e4dac26de7990352b1cb7547818f.html">hal</a></li><li class="navelem"><a class="el" href="a00554.html">swi_bitbang_samd21.h</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.15 </li>
  </ul>
</div>
</body>
</html>
